package view;

 
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;

import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
 
public class AnzeigeAuswertung extends JPanel {
 
    private static final long serialVersionUID = 1L;
    
    private JLabel lblCenterNumber;
    private JLabel[] lblResultat;
 
    public AnzeigeAuswertung() {
        setBorder(new LineBorder(new Color(0, 0, 0), 2));
        setBackground(Color.WHITE);
        
        setPreferredSize(new Dimension(100, 100));
        
        setLayout(new FormLayout(
            new ColumnSpec[] {
                ColumnSpec.decode("default:grow"),
                ColumnSpec.decode("default:grow"),
                ColumnSpec.decode("default:grow"),},
            new RowSpec[] {
                RowSpec.decode("default:grow"),
                RowSpec.decode("default:grow"),
                RowSpec.decode("default:grow(0.1)"),
                RowSpec.decode("default:grow"),
                RowSpec.decode("default:grow"),})
        );
        
        lblCenterNumber = new JLabel();
        lblCenterNumber.setOpaque(true);
        lblCenterNumber.setBackground(new Color(230, 230, 230));
        lblCenterNumber.setBorder(new LineBorder(new Color(0, 0, 0), 2));
        add(lblCenterNumber, "2, 2, 1, 3, fill, fill");
        
        lblResultat = new JLabel[6];
        for(int i=0; i<lblResultat.length; i++) {
            lblResultat[i] = new JLabel();
            lblResultat[i].setOpaque(true);
        }
        add(lblResultat[0], "1, 4, fill, fill");
        add(lblResultat[1], "1, 2, fill, fill");
        add(lblResultat[2], "2, 1, fill, fill");
        add(lblResultat[3], "3, 2, fill, fill");
        add(lblResultat[4], "3, 4, fill, fill");
        add(lblResultat[5], "2, 5, fill, fill");
    }
    
    public void setNummerMitte(int number) {
        lblCenterNumber.setText(String.valueOf(number));
    }
    
    public void setResultatNumber(double number, int index) {
        lblResultat[index].setText(String.valueOf(number));
    }
}